/**********************************
	A Class that Simplifies Drawing
	Text To the screen that can
	take an undefined ammount of
	Variables.

	By Julian Williams
	Jan 05, 2010
***********************************/


#include <SFML/Graphics.hpp>

#include <iostream>
#include <stdarg.h>


#include "text.h"


using namespace std;







Text::Text(const char* format, ...)
{

		  char err_buffer[256];

             va_list args;
             va_start( args, format );
             vsprintf( err_buffer, format, args );
             va_end( args );

			 string text_with_arg(err_buffer);
		
			 Text::SetString(sf::String(text_with_arg.c_str()));


}


/* Simple Static routine that returns text with variables */
string Text::Create_TextWithArgs(const char *format, ...)
{ 
			 char err_buffer[256];

             va_list args;
             va_start( args, format );
             vsprintf( err_buffer, format, args );
             va_end( args );

			 string text_with_arg(err_buffer);

			 return text_with_arg;
}//EoF


/* Set the Text with Args */
void Text::Set_TextWithArgs(const char* format, ...)
{

			 char err_buffer[256];

             va_list args;
             va_start( args, format );
             vsprintf( err_buffer, format, args );
             va_end( args );

			 string text_with_arg(err_buffer);
		
			 Text::SetString(sf::String(text_with_arg.c_str()));
}//EoF